package org.budo.cmbc.sdk.entity;

import org.budo.xml.XmlObject;

import lombok.extern.slf4j.Slf4j;

/**
 * @author lmw
 */
@Slf4j
public class QryOthBankAgentPayResResponse extends AbstractCmbcResponse {
    private static final long serialVersionUID = 7992818854911133222L;

    public QryOthBankAgentPayResResponse(String responseXml) {
        this.setResponseBody(responseXml);
    }

    public String getFileContent() {
        XmlObject xDataBody = this.xDataBody(this.getResponseBody());

        if (null == xDataBody) {
            log.error("#22 xDataBody=" + xDataBody + ", responseBody=" + this.getResponseBody());
            return null;
        }

        XmlObject otherBankBatchAgent = xDataBody.getChildNodeByName("otherBankBatchAgent");
        if (null == otherBankBatchAgent) {
            log.error("#28 xDataBody=" + xDataBody + ", responseBody=" + this.getResponseBody());
            return null;
        }

        return otherBankBatchAgent.getChildNodeTextContentByName("fileContent");
    }

    @Override
    public String toString() {
        return super.toString() + ", responseBody=" + this.getResponseBody();
    }
}

//<?xml version="1.0" encoding="UTF-8"?>
//<CMBC trnCode="qryOthBankAgentPayRes" security="none" lang="chs" header="100" version="100"> 
//<responseHeader> 
//  <status> 
//    <code>0</code>  
//    <severity>info</severity>  
//    <message>ok</message> 
//  </status>  
//  <dtServer>2021-04-29 10:45:59</dtServer>  
//  <userKey>N</userKey>  
//  <dtDead/>  
//  <language>chs</language> 
//</responseHeader>  
//<xDataBody> 
//  <statusId> 
//    <statusCode>0</statusCode>  
//    <statusSeverity>ok</statusSeverity>  
//    <statusErrMsg>批量支付受理成功！</statusErrMsg> 
//  </statusId>  
//  <otherBankBatchAgent> 
//    <trnId>TJ21429095235133</trnId>  
//    <insId>00000002</insId>  
//    <fileContent>6216923723716577|徐�R||0.02|10|成功|00000002|^</fileContent> 
//  </otherBankBatchAgent> 
//</xDataBody> 
//</CMBC>

